Block the previous action when calling reset() to prevent accidental
authorMatthias Clasen <matthiasc@src.gnome.org>
Tue, 27 Jan 2009 00:25:21 +0000 (00:25 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 27 Jan 2009 00:25:21 +0000 (00:25 +0000)
       * gtk/gtkactivatable.c (gtk_activatable_do_set_related_action):
        Block the previous action when calling reset() to prevent
        accidental activation of the previous action.

        * gtk/gtkaction.c (gtk_action_activate): Don't compare booleans.

        * gtk/gtktoggleaction.c (gtk_toggle_action_set_active): Remove
        extraneous braces.

svn path=/trunk/; revision=22225

ChangeLog
gtk/gtkaction.c
gtk/gtkactivatable.c
gtk/gtktoggleaction.c

index a6def620d887dca640a4277f8e8b6e9ee8bfbfa8..4ce10435dbda930ac32f00956252cdbef7673ecf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-01-26  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkactivatable.c (gtk_activatable_do_set_related_action):
+       Block the previous action when calling reset() to prevent
+       accidental activation of the previous action.
+
+       * gtk/gtkaction.c (gtk_action_activate): Don't compare booleans.
+
+       * gtk/gtktoggleaction.c (gtk_toggle_action_set_active): Remove
+       extraneous braces.
+
 2009-01-26  Bastien Nocera  <hadess@hadess.net>
 
        Bug 569240 - Crasher when using markers
index 6d29ca4e3473c7b498439fde42ea7fad30d47342..9ce778eaef00ef431583bb0f4fe26f12b818f334 100644 (file)
@@ -750,8 +750,10 @@ gtk_action_activate (GtkAction *action)
 {
   g_return_if_fail (GTK_IS_ACTION (action));
   
-  if (action->private_data->activate_blocked == FALSE &&
-      gtk_action_is_sensitive (action))
+  if (action->private_data->activate_blocked)
+    return;
+
+  if (gtk_action_is_sensitive (action))
     _gtk_action_emit_activate (action);
 }
 
index 8a09143856d2b568efc786764521eaeded412b20..198c8ba975571a5911531fcbccaad668a9007c14 100644 (file)
@@ -443,12 +443,16 @@ gtk_activatable_do_set_related_action (GtkActivatable *activatable,
          
          _gtk_action_remove_from_proxy_list (prev_action, GTK_WIDGET (activatable));
          
-         g_object_unref (prev_action);
-
           /* Some apps are using the object data directly...
            * so continue to set it for a bit longer
            */
           g_object_set_data (activatable, "gtk-action", NULL);
+
+          /*
+           * We don't want prev_action to be activated
+           * during the reset() call when syncing "active".
+           */ 
+          gtk_action_block_activate (prev_action);
        }
       
       /* Some applications rely on their proxy UI to be set up
@@ -457,6 +461,12 @@ gtk_activatable_do_set_related_action (GtkActivatable *activatable,
        */
       gtk_activatable_reset (activatable, action);
 
+      if (prev_action)
+        {
+          gtk_action_unblock_activate (prev_action);
+         g_object_unref (prev_action);
+        }
+
       if (action)
        {
          g_object_ref (action);
index 19930ecefd3205f893bab03fde3f103583a4207a..42217fc9204f1f6bbe38300e4aadbc3476150090 100644 (file)
@@ -267,9 +267,7 @@ gtk_toggle_action_set_active (GtkToggleAction *action,
   is_active = is_active != FALSE;
 
   if (action->private_data->active != is_active)
-    {
-      _gtk_action_emit_activate (GTK_ACTION (action));
-    }
+    _gtk_action_emit_activate (GTK_ACTION (action));
 }
 
 /**